package com.icee.myth.manager.encoder;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 因为Jar文件数据格式可以被JarInputStream解析，这里不需要增加任何头部信息
 * @author liuxianke
 */
public class ManagerToBootstrapEncoder extends MessageToByteEncoder {

    public ManagerToBootstrapEncoder() {
        super();
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
        if (msg instanceof byte[]){
            out.writeBytes(Unpooled.copiedBuffer((byte[])msg));
        }
    }

}
